<script setup lang="ts">
import { reactive, ref, watch, computed } from 'vue'


const ideoList = reactive(
    [
        {
            id: 1,
            title: '顺职赛博朋克',
            src: '//player.bilibili.com/player.html?aid=853987833&bvid=BV13L4y1F7Wj&cid=715420168&page=1',
            time: '02:00'
        },
        {
            id: 2,
            title: '顺德回忆录',
            src: '//player.bilibili.com/player.html?aid=596437561&bvid=BV19B4y1C72Y&cid=715414528&page=1',
            time: '08:40'
        }, {
            id: 3,
            title: '成功人士巅峰住宅',
            src: '//player.bilibili.com/player.html?aid=247640439&bvid=BV11v41177CS&cid=326517517&page=1',
            time: '10:00'
        }, {
            id: 4,
            title: '讲好党史故事',
            src: '//player.bilibili.com/player.html?aid=460821926&bvid=BV185411g7h2&cid=344544659&page=1',
            time: '9:00'
        }, {
            id: 5,
            title: '学法止纷争',
            src: '//player.bilibili.com/player.html?aid=970650851&bvid=BV1op4y1z7Ah&cid=266194072&page=1',
            time: '07:20'
        }, {
            id: 6,
            title: '顺职盛夏回忆',
            src: '//player.bilibili.com/player.html?aid=759216909&bvid=BV1h64y1z7UZ&cid=369743976&page=1',
            time: '04:20'
        }, {
            id: 7,
            title: '数学之美-科赫雪花',
            src: '//player.bilibili.com/player.html?aid=211873566&bvid=BV1ya411872L&cid=515546218&page=1',
            time: '2:20'
        }, {
            id: 8,
            title: 'React快速入门',
            src: '//player.bilibili.com/player.html?aid=849493257&bvid=BV1ZL4y1p7Ds&cid=450705772&page=1',
            time: '10:20'
        }
    ]
)

const currentVideo = ref(ideoList[0].src)
const currentIndex = ref(1)

const switchVideo = (id: number) => {
    currentVideo.value = ideoList[id - 1].src
    currentIndex.value = id
};




</script>
    
<template>
    <div class="container">
        <div class="left">
            <div class="video">
                <!-- <video  controls autoplay>
                    <source src="https://xbeibeix.com/api/bilibili/biliplayer/?url=BV13L4y1F7Wj" type="video/mp4">
                </video> -->
                <iframe :src="currentVideo" scrolling="no" border="0" frameborder="no" framespacing="0"
                    allowfullscreen="true" style="width:100% ;height:100%;"> </iframe>
                <!-- <video src="https://xbeibeix.com/api/bilibili/biliplayer/?url=BV13L4y1F7Wj" controls
                    poster="../../../assets/logo.svg"></video> -->
            </div>·
        </div>
        <div class="right">
            <div class="itemList">
                <div class="item" :class="currentIndex == item.id ? 'acrive' : ''" v-for="item in ideoList" :key="item.id"
                    @click="switchVideo(item.id)">
                    <span>{{ item.id }}</span>
                    <span>{{ item.title }}</span>
                    <span>{{ item.time }}</span>
                </div>
            </div>
            <div class="footer">
                <img src="@/assets/imlogo.svg" alt="" style="width:150px ;">
            </div>
        </div>
    </div>
</template>
    
<style scoped lang="scss">
.container {
    width: 100%;
    height: 100%;
    @include flex;

    .left {
        width: 80%;
        height: 100%;
        @include flex;

        .video {
            width: 80%;
            height: 70%;
            border: 30px solid $bgcolor;
            box-shadow: $box-shadow;
            background-color: #000000;

            video {
                width: 100%;
                height: 100%;
            }
        }
    }

    .right {
        width: 20%;
        height: 100%;
        box-shadow: inset 3px 3px 4px #c8d0e7, inset -3px -3px 4px #fff;

        .itemList {
            .acrive {
                box-shadow: $box-shadow;
                color: #659264;
                color: $blue-color;
                box-shadow: inset 3px 3px 4px #c8d0e7, inset -3px -3px 4px #fff;
            }

            .item {
                position: relative;
                margin: 10px auto;
                border-radius: 5px;
                width: 200px;
                height: 30px;
                cursor: pointer;
                @include flex(flex-start);
                font-size: 14px;

                span:nth-child(1) {
                    margin: 0 10px;
                    width: 20px;
                    height: 20px;
                    border-radius: 50%;
                    @include flex;
                }

                span:nth-child(2) {
                    width: 100px;
                    white-space: nowrap; //不允许换行
                    overflow: hidden; //超出包裹器隐藏
                    text-overflow: ellipsis; //显示省略符号来代表被修剪的文本。
                }

                span:nth-child(3) {
                    position: absolute;
                    right: 10px;

                }
            }
        }
        .footer{
            @include flex();
            margin-top: 100px;
        }

    }
}
</style>